# encoding: utf-8
"""
@author: 夏洛
@QQ: 1972386194
@file: 05-补环境selenium.py
"""

from selenium import webdriver
import os
from flask import Flask,jsonify

app = Flask(__name__)


PRO_DIR = os.path.dirname(os.path.abspath(__file__))
import time
def driver_sig(html_file):
    option = webdriver.ChromeOptions()
    option.add_argument('--disable-blink-features=AutomationControlled')
    option.add_argument('headless')
    driver = webdriver.Chrome(chrome_options=option)
    driver.get(PRO_DIR +'\\'+ html_file)
    sig = driver.find_element_by_id('data')
    v = sig.text
    return v

html_file = 'index.html'


@app.route('/')
def index():
    context = {
        'v' : driver_sig(html_file)
    }
    return jsonify(context=context)

if __name__ == '__main__':
    app.run()
    # pass





